#pragma once

#include "stdafx.h"

class Settings
{
private:
	Settings(void);
	~Settings(void);

public:

	static Settings& Instance()
	{
		static Settings settings;
		return settings;
	}

	void reset(){
		alwayson = enabledOnStart = 0;
		enabled = alwaysonOnStart = 0;
		useregex = useregexOnStart= 0;
		checksubj = checksubjOnStart = 0;
		mask.erase();
		maskOnStart.erase();
	}

	void apply(){
		alwaysonOnStart = alwayson;
		enabledOnStart = enabled;
		useregexOnStart = useregex;
		checksubjOnStart = checksubj;
		maskOnStart = mask;
		save();
	}
	
	bool isDirty()
	{
		return enabled!=enabledOnStart || alwayson!=alwaysonOnStart || 
			useregex!=useregexOnStart || checksubj!=checksubjOnStart ||
			mask!=maskOnStart;
	}

	void getSettings(VARIANT_BOOL &enbld, VARIANT_BOOL &alwon, VARIANT_BOOL &usergx, VARIANT_BOOL &chksubj, tstring &msk);
	void load();

private:
	void save();
	
	VARIANT_BOOL enabledOnStart, alwaysonOnStart,useregexOnStart,checksubjOnStart;
	tstring maskOnStart;

public:
	VARIANT_BOOL enabled,alwayson,useregex,checksubj;
	tstring mask;
};
